/**
 * 2. Write a program in Java to develop overloaded constructor. Also develop the copy constructor to create a new object with the state of the existing object. real life example
 */

class Boy {
    String name;
    int age;

    // Default constructor
    Boy() {
        name = "Unknown";
        age = 0;
    }

    // Overloaded constructor with name and age parameters
    Boy(String name, int age) {
        this.name = name;
        this.age = age;
    }

    // Copy constructor
    Boy(Boy original) {
        this.name = original.name;
        this.age = original.age;
    }

    void displayInfo() {
        System.out.println("Name: " + name);
        System.out.println("Age: " + age);
    }
}

public class ConstructorExample {
    public static void main(String[] args) {
        // Using the default constructor
        var boy1 = new Boy();
        System.out.println("Boy 1:");
        boy1.displayInfo();
        System.out.println("-----------------");

        // Using the overloaded constructor
        var boy2 = new Boy("Durjoy", 25);
        System.out.println("Durjoy 2:");
        boy2.displayInfo();
        System.out.println("-----------------");

        // Using the copy constructor
        var person3 = new Boy(boy2);
        System.out.println("Boy 3 (Copy of Boy 2):");
        person3.displayInfo();
    }
}

